<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        let str = '2018-03-23';
        let res = /(\d{4})-(\d{2})-(\d{2})/

        let dateArr = str.match(res);

        let year = dateArr[1];
        let month = dateArr[2]
        let day = dateArr[3]
        console.log(year, month, day);
        console.log(str.match(res));
    </script>
</head>
<body>
    
</body>
</html>